<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>Hello React!</title>
<!-- <script src="https://cdn.staticfile.org/react/16.4.0/umd/react.development.js"></script>
<script src="https://cdn.staticfile.org/react-dom/16.4.0/umd/react-dom.development.js"></script>
<script src="https://cdn.staticfile.org/babel-standalone/6.26.0/babel.min.js"></script> -->
<script src="./react.development.js"></script>
<script src="./react-dom.development.js"></script>
<script src="./babel.min.js"></script>
<script src="./prop-types.js"></script>
</head>
<body>
<div id="example"></div>
<div id="example1"></div>
<div id="example2"></div>
<div id="example3"></div>
<script type="text/babel">
class IsLike extends React.Component{
  constructor(props){
    super(props);
    //初始化状态
    this.state = {
      isLike:true,
    };
    this.changeLike = this.changeLike.bind(this)
  }
  changeLike(){
    //修改状态
    this.setState({
      isLike:!this.state.isLike
    })
  }
  render(){
    let {isLike} = this.state;
    let msg = isLike?'I LOVE YOU!':'YOU LOVE ME!';
    return(
      <h2 onClick={this.changeLike}>{msg}</h2>
    )
  }
}
ReactDOM.render(<IsLike />,document.getElementById('example'))
</script>
</body>
</html>